import instance from "@/utils/requestUtils";


let roleApi = {
    //分页条件查询
    searchPage(searchForm) {
        return instance.get('role', {params: searchForm})
    },

    findById(id) {
        return instance.get(`role/${id}`)
    },

    add(role) {
        return instance.post(`role`, role);
    },
    update(role) {
        return instance.put(`role`, role);
    },
    deleteById(id) {
        return instance.delete(`role/${id}`)
    },
    batchDelete(ids) {
        return instance.delete(`role/batch/${ids}`)
    },

    getAllMenuTree() {
        return instance.get(`menu/allMenuTree`)
    },

    setRoleMenu(roleId, menuIds) {
        return instance.put(`role/${roleId}/menu/${menuIds}`)
    },

    getRoleMenu(id) {
        return instance.get(`role/${id}/menus`)
    }

}

export default roleApi;
